/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package me.zhengjie.modules.biz.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.*;

import java.sql.Timestamp;
import java.io.Serializable;

/**
 * @author Admin
 * @website https://eladmin.vip
 * @description /
 * @date 2023-03-09
 **/
@Entity
@Data
@Table(name = "hj_hazardous_chemicals_change_record")
public class HazardousChemicalsChangeRecord implements Serializable {
    public static final int STATE_PAN_KU = 5;//盘库
    public static final int STATE_SELL_INVENTORY = 4;//销库
    public static final int STATE_GIVE_BACK = 3;//归还
    public static final int STATE_OUTPUT = 2;//出库、领用
    public static final int STATE_INPUT = 1;//入库

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`name`")
    @ApiModelProperty(value = "化学品名称")
    private String name;

    @Column(name = "`hc_id`")
    @ApiModelProperty(value = "hcId")
    private Integer hcId;

    @Column(name = "`type`")
    @ApiModelProperty(value = "类型")
    private Integer type;

    @Column(name = "`state`")
    @ApiModelProperty(value = "状态")
    private Integer state;

    @Column(name = "`amount`")
    @ApiModelProperty(value = "数量")
    private Float amount;

    @Column(name = "`created_at`")
    @CreationTimestamp
    @ApiModelProperty(value = "createdAt")
    private Timestamp createdAt;

    @Column(name = "`updated_at`")
    @UpdateTimestamp
    @ApiModelProperty(value = "updatedAt")
    private Timestamp updatedAt;

    @Column(name = "`count_type`")
    @ApiModelProperty(value = "计数类型")
    private Integer countType;

    @Column(name = "number")
    @ApiModelProperty(value = "编号")
    private String number;

    @Column(name = "batch_number")
    @ApiModelProperty(value = "批次")
    private String batchNumber;

    @Column(name = "ingredient_data")
    @ApiModelProperty(value = "成分")
    private String ingredientData;

    @Column(name = "matrix")
    @ApiModelProperty(value = "基体")
    private String matrix;

    @Column(name = "attenuation")
    @ApiModelProperty(value = "稀释方法")
    private String attenuation;

    @Column(name = "expiration_date")
    @ApiModelProperty(value = "有效期")
    private Timestamp expirationDate;

    @Column(name = "file_url")
    @ApiModelProperty(value = "证书")
    private String fileUrl;

    @Column(name = "order_id")
    @ApiModelProperty(value = "订单ID")
    private Integer orderId;

    @Column(name = "detail_number")
    @ApiModelProperty(value = "详细数量 ml,g")
    private Float detailNumber;

    @Column(name = "lq_number")
    @ApiModelProperty(value = "领取量 ml,g")
    private Float lqNumber;

    @Column(name = "gh_number")
    @ApiModelProperty(value = "归还量 ml,g")
    private Float ghNumber;

    @Column(name = "used_number")
    @ApiModelProperty(value = "使用量 ml,g")
    private Float usedNumber;

    @Column(name = "`user_id`")
    @ApiModelProperty(value = "操作人")
    private Integer userId;

    @Column(name = "`is_return`")
    @ApiModelProperty(value = "领取操作是否已归还")
    private Integer isReturn;

    public void copy(HazardousChemicalsChangeRecord source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
